package thread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class MainShit {
public static void main(String[] args) {
    // 创建一个线程池
    ExecutorService executor = Executors.newFixedThreadPool(5);
    try {
        // 线程
        Runnable r1 = new ThreadShit("小明");
        Runnable r2 = new ThreadShit("小李");
        Runnable r3 = new ThreadShit("小赵");
        Runnable r4 = new ThreadShit("小周");
        Runnable r5 = new ThreadShit("小魏");
        // 执行任务
        executor.execute(r1);
        executor.execute(r2);
        executor.execute(r3);
        executor.execute(r4);
        executor.execute(r5);
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        executor.shutdown();
    }

}
}
